package com.zygh.policeasset.mapper;

import com.zygh.policeasset.pojo.QrCodeGenerated;
import com.zygh.policeasset.pojo.vo.QrCodeGeneratedVO;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/mapper/QrCodeGeneratedMapper.class */
public interface QrCodeGeneratedMapper {
    @Insert({"insert into qr_code_generated(build_num,section_id,type,create_time,company_id,build_name,section_name,flow_no,user_id) values(#{buildNum},#{sectionId},#{type},#{createTime},#{companyId},#{buildName},#{sectionName},#{flowNo},#{userId})"})
    Integer add(QrCodeGenerated qrCodeGenerated);

    @Select({"<script>select qg.*,c.company_name as companyName,d.dict_name as typeName,af.app_status,af.approval_steps_id as approvalStepsId,af.flow_no,u.name as userName from qr_code_generated qg left join dict_data d on qg.type = d.dict_value and d.dict_type = 'assetsType' left join company c on qg.company_id = c.id <if test='qrCode != null and qrCode.length &gt; 0'>LEFT JOIN qr_code_info qci on qg.id = qci.qr_code_generated_id </if>left join audit_flow af on qg.flow_no = af.flow_no left join user u on qg.user_id = u.id <where><if test='type != null and type.length &gt; 0'> qg.type  = #{type} </if><if test='name != null and name.length &gt; 0'>and qg.name  = #{name} </if><if test='buildNum != null and buildNum.length &gt; 0'>and qg.build_num  = #{buildNum} </if><if test='sectionId != null '>and qg.section_id  = #{sectionId} </if><if test='companyId != null '>and qg.company_id  = #{companyId} </if><if test='qrCode != null and qrCode.length &gt; 0'>and qci.qr_code  = #{qrCode} </if><if test='status != null '>and af.app_status = #{status} </if></where>order by qg.id desc</script>"})
    @Results({@Result(property = "buildNum", column = "build_num"), @Result(property = "buildName", column = "build_name"), @Result(property = "sectionId", column = "section_id"), @Result(property = "sectionName", column = "section_name"), @Result(property = "createTime", column = "create_time"), @Result(property = "flowNo", column = "flow_no"), @Result(property = "appStatus", column = "app_status")})
    List<QrCodeGeneratedVO> selectList(@Param("type") String str, @Param("name") String str2, @Param("buildNum") String str3, @Param("sectionId") Integer num, @Param("companyId") Integer num2, @Param("qrCode") String str4, @Param("userId") Integer num3, @Param("status") Integer num4);

    @Select({"<script>" +
            "select qg.*,c.company_name as companyName,d.dict_name as typeName," +
            "af.approval_steps_id as approvalStepsId,af.app_status,af.flow_no,u.name as userName " +
            "from qr_code_generated qg left join dict_data d on qg.type = d.dict_value " +
            "and d.dict_type = 'assetsType' left join company c on qg.company_id = c.id " +
            "left join audit_flow af on qg.flow_no = af.flow_no left join user u on qg.user_id = u.id " +
            "<where><if test='id != null '>qg.id=#{id}  </if>" +
            "</where>order by qg.id desc" +
            "</script>"})
    @Results({@Result(property = "buildNum", column = "build_num"), @Result(property = "buildName", column = "build_name"), @Result(property = "sectionId", column = "section_id"), @Result(property = "sectionName", column = "section_name"), @Result(property = "createTime", column = "create_time"), @Result(property = "flowNo", column = "flow_no"), @Result(property = "appStatus", column = "app_status")})
    QrCodeGeneratedVO selectById(@Param("id") Integer num);

    @Select({"<script>SELECT count(*)  FROM `qr_code_info` qci LEFT JOIN `qr_code_generated` qcg ON qci.qr_code_generated_id = qcg.id <where><if test='buildNum != null and buildNum.length &gt; 0'> qcg.build_num  = #{buildNum} </if><if test='sectionId != null '>  and qcg.section_id = #{sectionId} </if></where></script>"})
    Integer selectCountByBuildNum(@Param("buildNum") String str, @Param("sectionId") Integer num);

    @Select({"<script>SELECT count(*)  FROM `qr_code_info` qci LEFT JOIN `qr_code_generated` qcg ON qci.qr_code_generated_id = qcg.id <where><if test='buildNum != null and buildNum.length &gt; 0'> qcg.build_num  = #{buildNum} </if><if test='sectionId != null '>  and qcg.section_id = #{sectionId} </if><if test='qrCode != null and qrCode.length &gt; 0'>  and qci.qr_code = #{qrCode} </if></where></script>"})
    Integer selectCountByBuildNumAndSectionId(@Param("buildNum") String str, @Param("sectionId") Integer num, @Param("qrCode") String str2);

    @Delete({"delete from qr_code_generated where id = #{id}"})
    Integer delete(Integer num);

    @Select({"<script>select count(*) from qr_code_generated <where> <if test='type != null and type.length &gt; 0'> type  = #{type} </if><if test='buildNum != null and buildNum.length &gt; 0'>and build_num  = #{buildNum} </if><if test='sectionId != null '>and section_id  = #{sectionId} </if></where> </script>"})
    Integer selectCount(@Param("type") String str, @Param("buildNum") String str2, @Param("sectionId") Integer num);

    @Select({"select c.id from qr_code_generated c"})
    List<QrCodeGeneratedVO> doTest();

    @Results({@Result(property = "buildNum", column = "build_num"), @Result(property = "buildName", column = "build_name"), @Result(property = "sectionId", column = "section_id"), @Result(property = "sectionName", column = "section_name"), @Result(property = "createTime", column = "create_time"), @Result(property = "flowNo", column = "flow_no"), @Result(property = "appStatus", column = "app_status")})
    @Select({"select * from qr_code_generated where flow_no = #{flowNo}"})
    QrCodeGeneratedVO selectByflowNo(String str);

    @Update({"update qr_code_generated set flow_no = #{flowNo} where id=#{id}"})
    Integer updateFlowNo(@Param("flowNo") String str, @Param("id") Integer num);
}